﻿// ===============================================================================
// XCI.NET 西安交通信息WinForm开发框架 2018 版权所有
// ===============================================================================
using System.ComponentModel;
using DevExpress.Utils.Controls;
using DevExpress.Utils.Serializing;
using DevExpress.XtraGrid.Views.Base;

namespace XCI.Windows.Controls
{
    public class GridOptionsCustom : ViewBaseOptions
    {
        private bool allowShowPopupMenu = true;
        private bool allowAutoGeneratedColumns= true;
        private bool allowRecordModifyData = true;

        /// <summary>
        /// 是否显示右键菜单
        /// </summary>
        [Browsable(true)]
        [Description("是否显示右键菜单")]
        [DefaultValue(true)]
        [XtraSerializableProperty]
        public virtual bool AllowShowPopupMenu
        {
            get { return allowShowPopupMenu; }
            set
            {
                if (AllowShowPopupMenu == value) return;
                bool prevValue = AllowShowPopupMenu;
                allowShowPopupMenu = value;
                OnChanged(new BaseOptionChangedEventArgs("AllowShowPopupMenu", prevValue, AllowShowPopupMenu));
            }
        }
        
        /// <summary>
        /// 允许在没有配置时自动生成列
        /// </summary>
        [Browsable(true)]
        [Description("允许在没有配置时自动生成列")]
        [DefaultValue(true)]
        [XtraSerializableProperty]
        public bool AllowAutoGeneratedColumns
        {
            get { return allowAutoGeneratedColumns; }
            set
            {
                if (AllowAutoGeneratedColumns == value) return;
                bool prevValue = AllowAutoGeneratedColumns;
                allowAutoGeneratedColumns = value;
                OnChanged(new BaseOptionChangedEventArgs("AllowAutoGeneratedColumns", prevValue, AllowAutoGeneratedColumns));
            }
        }

        /// <summary>
        /// 允许记录修改的数据
        /// </summary>
        [Browsable(true)]
        [Description("允许记录修改的数据")]
        [DefaultValue(true)]
        [XtraSerializableProperty]
        public bool AllowRecordModifyData
        {
            get { return allowRecordModifyData; }
            set
            {
                if (AllowRecordModifyData == value) return;
                bool prevValue = AllowRecordModifyData;
                allowRecordModifyData = value;
                OnChanged(new BaseOptionChangedEventArgs("AllowRecordModifyData", prevValue, AllowRecordModifyData));
            }
        }
    }
}